{% extends "base.html" %}
{% block title %}Tools Mult Run Command{% endblock %}
{% block content %}
<div class="col-lg-12">
    <div class="panel panel-info">
        <div class="panel-heading">批量执行远程命令</div>
        <div class="panel-body">
            <form class="form-inline" method="POST">
              <div class="form-group">
                <label >COMMAND: </label>
                <input  class="form-control" name="command">
              </div>
              <button type="submit" class="btn btn-info">批量执行</button>
            </form>
        </div>
        <div class="panel-footer">
            {% if result %}
                    <table class="table">
                      <thead><tr><th>hostname</th><th>status</th><th>content</th></tr></thead>
                      <tbody>
                         {% for hostname in result %}
                            {% if result[hostname].code == 0 %}
                                <tr class="success">
                                  <td>{{ hostname }}</td>
                                  <td>执行成功</td>
                                  <td><pre>{{ result[hostname].data }}</pre></td>
                                </tr>
                            {% else %}
                                <tr class="danger">
                                  <td>{{ hostname }}</td>
                                  <td>{{ result[hostname].code }}</td>
                                  <td><pre>{{ result[hostname].message }}</pre></td>
                                </tr>
                            {% endif %}
                         {% endfor %}
                      </tbody>

                    </table>
            {% endif %}
        </div>
    </div>
</div>


{% endblock %}